const element = document.documentElement;

export function isFullscreen() {
  return document.fullscreenElement === element;
}

export function toggleFullscreen() {
  if (isFullscreen()) {
    if (document.exitFullscreen) {
      return document.exitFullscreen();
    }
  } else {
    if (element.requestFullscreen) {
      return element.requestFullscreen();
    }
  }
  return Promise.reject('不支持全屏操作');
}
